function SumList() {	
	var level = document.getElementById("rank");
	level.options.length = 0;
	level.options[0] = new Option("1+1", "1+1");
	level.options[1] = new Option("1+2", "1+2");
	level.options[2] = new Option("2+2=2", "2+2 = 2");
	level.options[3] = new Option("2+2=3", "2+2=3");
}

function DifList() {
	level = document.getElementById("rank");
	level.options.length = 0;
	level.options[0] = new Option("1-1", "1-1");
	level.options[1] = new Option("2-1", "2-1");
	level.options[2] = new Option("2-2", "2-2");
}

function MulList() {
	level = document.getElementById("rank");
	level.options.length = 0;
	level.options[0] = new Option("1*1", "1*1");
	level.options[1] = new Option("1*2=2", "1*2=2");
	level.options[2] = new Option("2*2=3", "2*2=3");
}

function DelList() {
	level = document.getElementById("rank");
	level.options.length = 0;
	level.options[0] = new Option("2/1", "2/1");
	level.options[1] = new Option("2/2", "2/2");
}

function SumDifList() {
	level = document.getElementById("rank");
	level.options.length = 0;
}

function MulDelList() {
	level = document.getElementById("rank");
	level.options.length = 0;
}

function AllList() {
	level = document.getElementById("rank");
	level.options.length = 0;
}

var operation = "undefined";
var operation_sign;
var operation_func;
var rank;
var ans = "";
var left_rank;
var right_rank;
var ans_rank;
var right_ans = 0;
var right_ans_rank;
var right_score = 0;
var wrong_score = 0;
var randomnumber1 = 0;
var randomnumber2 = 0;
var secCounter = 60;
var isGameOver = 0;
var left_nums = [];
var right_nums = [];

function Start() {		
	var op_form = document.getElementsByName("operation");
	var input_len = op_form.length;
	for (var i = 0; i < input_len; i++) {
		if (op_form[i].checked)
		{
			operation = op_form[i].value;
			break;
		}
	}
	if (operation == "undefined") return 0;
	
	op_form = document.getElementById("rank");
	rank = op_form.options[op_form.selectedIndex].value;
	
	switch (rank) {
		case "1+1":
			left_rank = 1;
			right_rank = 1;
			ans_rank = 0;
			break;
		case "1+2":
			left_rank = 1;
			right_rank = 2;
			ans_rank = 2;
			break;
		case "2+2=2":
			left_rank = 2;
			right_rank = 2;
			ans_rank = 2;
			break;
		case "2+2=3":
			left_rank = 2;
			right_rank = 2;
			ans_rank = 3;
			break;
		case "2-1":
			left_rank = 2;
			right_rank = 1;
			ans_rank = -1;
			break;
		case "2-2":
			left_rank = 2;
			right_rank = 2;
			ans_rank = -1;
			break;
		case "1*1":
			left_rank = 1;
			right_rank = 1;
			ans_rank = -1;
			break;
		case "1*2=2":
			left_rank = 1;
			right_rank = 2;
			ans_rank = 2;
			break;
		case "1*2=3":
			left_rank = 1;
			right_rank = 2;
			ans_rank = 3;
			break;
		case "1*2=3":
			left_rank = 1;
			right_rank = 2;
			ans_rank = 3;
			break;
		case "2/1":
			left_rank = 2;
			right_rank = 1;
			ans_rank = -1;
			break;
		case "2/2":
			left_rank = 2;
			right_rank = 2;
			ans_rank = -1;
			break;
	}
	
	switch (operation) {
		case "Sum":
			operation_func = newSum;
			operation_sign = "+";
			break;
		case "Dif":
			operation_func = newDif;
			operation_sign = "-";
			break;
		case "Multiply":
			operation_func = newMultiply;
			operation_sign = "*";
			break;
		case "Del":
			operation_func = newDel;
			operation_sign = "/";
			break;
		case "SumDif":
			operation_func = newSumDif;
			break;
		case "MulDel":
			operation_func = newMulDel;
			break;
		case "All":
			operation_func = newAll;
			break;
	}
}

function newSum() {}
function newDif() {}
function newMultiply() {}
function newDel() {}
function newSumDif() {}
function newMulDel() {}
function newAll() {}